toaster: custom breadcrumb for the default project
PATCH 1/1 toaster: custom breadcrumb for the default project
From: Belen Barros Pena <[email protected]>
The default "Command line builds" project does not have a Configuration page. It therefore needs a custom breadcrumb where the project name goes to the project builds page, instead of the project configuration page.
--- .../lib/toaster/toastergui/templates/basebuilddetailpage.html | 9 +++++++-- bitbake/lib/toaster/toastergui/templates/basebuildpage.html | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-)
bitbake/lib/toaster/toastergui/templates/basebuilddetailpage.html +7 -2
@@ -6,8 +6,13 @@ <!-- Breadcrumbs --> <div class="section"> <ul class="breadcrumb" id="breadcrumb"> - <li><a href="{% url 'project' build.project.id %}">{{build.project.name}}</a></li> - <li><a href="{% url 'projectbuilds' build.project.id %}">Builds</a></li> + <li><a href=" + {% if build.project.is_default %} + {% url 'projectbuilds' build.project.id %}">{{build.project.name}}</a></li> + {% else %} + {% url 'project' build.project.id %}">{{build.project.name}}</a></li> + <li><a href="{% url 'projectbuilds' build.project.id %}">Builds</a></li> + {% endif %} <li><a href="{%url 'builddashboard' build.pk%}">{{build.get_sorted_target_list.0.target}} {%if build.target_set.all.count > 1%}(+{{build.target_set.all.count|add:"-1"}}){%endif%} {{build.machine}} ({{build.completed_on|date:"d/m/y H:i"}})</a></li> {% block localbreadcrumb %}{% endblock %} </ul>
bitbake/lib/toaster/toastergui/templates/basebuildpage.html +7 -2
@@ -8,8 +8,13 @@ <!-- Breadcrumbs --> <div class="section"> <ul class="breadcrumb" id="breadcrumb"> - <li><a href="{% url 'project' build.project.id %}">{{build.project.name}}</a></li> - <li><a href="{% url 'projectbuilds' build.project.id %}">Builds</a></li> + <li> + {% if build.project.is_default %} + <a href="{% url 'projectbuilds' build.project.id %}">{{build.project.name}}</a></li> + {% else %} + <a href="{% url 'project' build.project.id %}">{{build.project.name}}</a></li> + <li><a href="{% url 'projectbuilds' build.project.id %}">Builds</a></li> + {% endif %} <li> {% block parentbreadcrumb %} <a href="{%url 'builddashboard' build.pk%}">
Signature · 1 line
2.5.4 (Apple Git-61)
Hello Belen, quick comment below.
Quoted 34 lines · Belen Barros Pena
From: Belen Barros Pena <[email protected]>
The default "Command line builds" project does not have a Configuration page. It therefore needs a custom breadcrumb where the project name goes to the project builds page, instead of the project configuration page.
Signed-off-by Belen Barros Pena <[email protected]>--- .../lib/toaster/toastergui/templates/basebuilddetailpage.html | 9 +++++++-- bitbake/lib/toaster/toastergui/templates/basebuildpage.html | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-)diff --git a/bitbake/lib/toaster/toastergui/templates/basebuilddetailpage.html b/bitbake/lib/toaster/toastergui/templates/basebuilddetailpage.html index e350c1a..7f35cdf 100644
bitbake/lib/toaster/toastergui/templates/basebuilddetailpage.html +0
-1@@ -6,8 +6,13 @@ <!-- Breadcrumbs --> <div class="section"> <ul class="breadcrumb" id="breadcrumb"> - <li><a href="{% url 'project' build.project.id %}">{{build.project.name}}</a></li>
- <li><a href="{% url 'projectbuilds' build.project.id
%}">Builds</a></li>bitbake/lib/toaster/toastergui/templates/basebuilddetailpage.html +3
-0+ <li><a href=" + {% if build.project.is_default %} + {% url 'projectbuilds' build.project.id %}">{{build.project.name}}</a></li>
bitbake/lib/toaster/toastergui/templates/basebuilddetailpage.html +2
-0+ {% else %} + {% url 'project' build.project.id %}">{{
Quoted 2 lines
build.project.name}}</a></li>
You can use the project_url helper (see project_url_tag.py) to give you the correct URL for the main page for a project, depending on whether it's the default project or not.
Add this at the top of the template:
{% load project_url_tag %}
Then replace your changes with:
<li><a href="{% project_url build.project %}">{{build.project.name }}</a></li>
Elliot
+ <li><a href="{% url 'projectbuilds' build.project.id
Quoted 43 lines
%}">Builds</a></li>
+ {% endif %}<li><a href="{%url 'builddashboard' build.pk%}">{{build.get_sorted_target_list.0.target}} {%if build.target_set.all.count > 1%}(+{{build.target_set.all.count|add:"-1"}}){%endif%} {{build.machine}} ({{build.completed_on|date:"d/m/y H:i"}})</a></li> {% block localbreadcrumb %}{% endblock %} </ul>bitbake/lib/toaster/toastergui/templates/basebuildpage.html +0
-1@@ -8,8 +8,13 @@ <!-- Breadcrumbs --> <div class="section"> <ul class="breadcrumb" id="breadcrumb"> - <li><a href="{% url 'project' build.project.id %}">{{build.project.name}}</a></li>
- <li><a href="{% url 'projectbuilds' build.project.id
%}">Builds</a></li>bitbake/lib/toaster/toastergui/templates/basebuildpage.html +3
-0+ <li> + {% if build.project.is_default %} + <a href="{% url 'projectbuilds' build.project.id %}">{{build.project.name}}</a></li>
bitbake/lib/toaster/toastergui/templates/basebuildpage.html +2
-0+ {% else %} + <a href="{% url 'project' build.project.id %}">{{build.project.name}}</a></li>
+ <li><a href="{% url 'projectbuilds' build.project.id
%}">Builds</a></li>
+ {% endif %}<li> {% block parentbreadcrumb %} <a href="{%url 'builddashboard' build.pk%}">--
2.5.4 (Apple Git-61)--
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster
Signature · 3 lines
Elliot Smith Software Engineer Intel Open Source Technology Centre
Quoted 1 line · Elliot
Hello Belen, quick comment below.
Thanks for the feedback. V2 on the way.
Cheers
Belén
Quoted 133 lines
On 23 February 2016 at 16:55, Belen Barros Pena
<[email protected]> wrote:From: Belen Barros Pena <[email protected]>
The default "Command line builds" project does not have a Configuration page. It therefore needs a custom breadcrumb where the project name goes to the project builds page, instead of the project configuration page.
Signed-off-by Belen Barros Pena <[email protected]>---
.../lib/toaster/toastergui/templates/basebuilddetailpage.html | 9
+++++++--
bitbake/lib/toaster/toastergui/templates/basebuildpage.html | 9
+++++++--2 files changed, 14 insertions(+), 4 deletions(-)(quoted diff) +0
-0a/bitbake/lib/toaster/toastergui/templates/basebuilddetailpage.html b/bitbake/lib/toaster/toastergui/templates/basebuilddetailpage.html index e350c1a..7f35cdf 100644
bitbake/lib/toaster/toastergui/templates/basebuilddetailpage.html +0
-0@@ -6,8 +6,13 @@<!-- Breadcrumbs -->
<div class="section">
<ul class="breadcrumb" id="breadcrumb">
- <li><a href="{% url 'project'
build.project.id <http://build.project.id> %}">{{build.project.name
<http://build.project.name>}}</a></li>
- <li><a href="{% url 'projectbuilds'
build.project.id <http://build.project.id> %}">Builds</a></li>bitbake/lib/toaster/toastergui/templates/basebuilddetailpage.html +3
-0+ <li><a href=" + {% if build.project.is_default %} + {% url 'projectbuilds'build.project.id <http://build.project.id> %}">{{build.project.name
<http://build.project.name>}}</a></li>bitbake/lib/toaster/toastergui/templates/basebuilddetailpage.html +2
-0+ {% else %} + {% url 'project'build.project.id <http://build.project.id> %}">{{build.project.name
<http://build.project.name>}}</a></li>You can use the
project_urlhelper (seeproject_url_tag.py) to give you the correct URL for the main page for a project, depending on whether it's the default project or not.Add this at the top of the template:
{% load
project_url_tag%}Then replace your changes with:
<li><a href="{%
project_urlbuild.project %}">{{build.project.name
<http://build.project.name/>}}</a></li>Elliot
+ <li><a href="{% url 'projectbuilds'
build.project.id <http://build.project.id> %}">Builds</a></li>
+ {% endif %}<li><a href="{%url 'builddashboard'build.pk <http://build.pk>%}">{{build.get_sorted_target_list.0.target}}
{%if build.target_set.all.count > 1%}(+{{build.target_set.all.count|add:"-1"}}){%endif%} {{build.machine}} ({{build.completed_on|date:"d/m/y H:i"}})</a></li>{% block localbreadcrumb %}{% endblock %} </ul>bitbake/lib/toaster/toastergui/templates/basebuildpage.html +0
-0@@ -8,8 +8,13 @@<!-- Breadcrumbs -->
<div class="section">
<ul class="breadcrumb" id="breadcrumb">
- <li><a href="{% url 'project'
build.project.id <http://build.project.id> %}">{{build.project.name
<http://build.project.name>}}</a></li>
- <li><a href="{% url 'projectbuilds'
build.project.id <http://build.project.id> %}">Builds</a></li>bitbake/lib/toaster/toastergui/templates/basebuildpage.html +3
-0+ <li> + {% if build.project.is_default %} + <a href="{% url 'projectbuilds'build.project.id <http://build.project.id> %}">{{build.project.name
<http://build.project.name>}}</a></li>bitbake/lib/toaster/toastergui/templates/basebuildpage.html +2
-0+ {% else %} + <a href="{% url 'project'build.project.id <http://build.project.id> %}">{{build.project.name
<http://build.project.name>}}</a></li>
+ <li><a href="{% url 'projectbuilds'
build.project.id <http://build.project.id> %}">Builds</a></li>
+ {% endif %}<li> {% block parentbreadcrumb %} <a href="{%url 'builddashboard'build.pk <http://build.pk>%}">
--
2.5.4 (Apple Git-61)--
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toasterSignature · 3 lines
Elliot Smith Software Engineer Intel Open Source Technology Centre